
#ifndef _GANIMATOR_H_
#define _GANIMATOR_H_

#include "../skelanim/skeleton.h"
#include "../skelanim/motion.h"
#include "../skelanim/animator.h"
#include "gskeleton.h"

#include "../filter/filter.h"

class GAnimator: public Animator {
   
public:
   GAnimator();
   GAnimator(const GAnimator&);
   GAnimator(GSkeleton *, Skeleton *, Motion *);
   virtual ~GAnimator() { if (filter != 0 ) delete filter; }
   
   void frame(int f);
   
   void filterClear() { filter->clear(); }
   
protected:
   void setting();
   void transform(int i);
   
   const Number &getLegRatio() const { return legRatio; }
   
protected:
   
   GSkeleton                 *gskeleton;
   vector<Point3>             ijoints; // initial joints positions
   OMR::MotionFilter         *filter;
   
   // variables used for supporting the filter process in the correct format
   Number                     legRatio; //
   vector<int>                jco; // array de correspondencias de joints (util para estar en el formato que el filtro necesita)
   vector<int>                jcoI; // array de correspondencias inverso de joints (util para estar en el formato que el filtro necesita)
   vector<int>                mprev; // input for the filter
   vector<OMR::Vector3>       mjoints; // input for the filter
};

#endif
